import { BasicColumn } from '/@/components/Table';
//列表数据
const  enIN  = new Intl.NumberFormat('en-US', {
  style: 'decimal',
  minimumFractionDigits: 2,
  maximumFractionDigits: 2
});
export const columns: BasicColumn[] = [
  {
    title: '业务员',
    align: 'center',
    dataIndex: 'salesman',
    width: 200,
    customCell: (record: any) => {
      if (record.area === '合计') {
        return {
          rowSpan: 1,
          colSpan: 0,
        };
      }
      return {
        rowSpan: record.rowSpan,
      };
    },
  },
  {
    title: '地区',
    align: 'center',
    dataIndex: 'area',
    width: 200,
    customCell: (record: any) => {
      if (record.area === '合计') {
        return {
          rowSpan: 1,
          colSpan: 2,
        };
      }
      return {
        colSpan: 1,
      };
    },
  },
  {
    title: '总保费',
    align: 'center',
    dataIndex: 'cost',
    customRender: ({ value }) => {
      let  num =  value ? value.toFixed(2) : 0;
      return enIN.format(num);
    },
  },
  {
    title: '税后总保费',
    align: 'center',
    dataIndex: 'exTaxPremium',
    customRender: ({ value }) => {
      let  num =  value ? value.toFixed(2) : 0;
      return enIN.format(num);
    },
  },
  {
    title: '总经纪费',
    align: 'center',
    dataIndex: 'insuranceFee',
    customRender: ({ value }) => {
      let  num =  value ? value.toFixed(2) : 0;
      return enIN.format(num);
    },
  },
  {
    title: '营销费用',
    align: 'center',
    dataIndex: 'salesmanFee',
    customRender: ({ value }) => {
      let  num =  value ? value.toFixed(2) : 0;
      return enIN.format(num);
    },
  },

  {
    title: '系统服务商费用',
    align: 'center',
    dataIndex: 'systemFee',
    customRender: ({ value }) => {
      let  num =  value ? value.toFixed(2) : 0;
      return enIN.format(num);
    },
  },
  {
    title: '经纪公司费用',
    align: 'center',
    dataIndex: 'proxyFree',
    customRender: ({ value }) => {
      let  num =  value ? value.toFixed(2) : 0;
      return enIN.format(num);
    },
  },
  {
    title: '结余',
    align: 'center',
    dataIndex: 'income',
    customRender: ({ value }) => {
      let  num =  value ? value.toFixed(2) : 0;
      return enIN.format(num);
    },
  },
  {
    title: '收入比',
    align: 'center',
    dataIndex: 'incomeRate',
    customRender: ({ value }) => {
      return value ? `${(value).toFixed(2)}%` : 0;
    },
  },
];
